package routers

import (
	"dc-news/common/middleware/jwt"
	"dc-news/controller"
	"github.com/gin-gonic/gin"
)

func SetupCommentRouter(r *gin.Engine) {
	v1Group := r.Group("api/v1/comment")
	authGroup := v1Group.Group("")
	authGroup.Use(jwt.Auth(false))
	{
		authGroup.GET("/:id", controller.GetCommentHandler)
		authGroup.GET("/:id/comments", controller.GetCommentCommentsHandler)
	}

	mustAuthGroup := v1Group.Group("")
	mustAuthGroup.Use(jwt.Auth(true))
	{
		mustAuthGroup.POST("", controller.AddCommentHandler)
		mustAuthGroup.POST("/:id/likes", controller.LikesCommentHandler)
		mustAuthGroup.DELETE("/:id/likes", controller.CancelLikesCommentHandler)
	}
}
